package top.infopub.mgr.hr.service.impl;


import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import top.infopub.generic.GenericDao;
import top.infopub.generic.GenericServiceImpl;
import top.infopub.mgr.hr.dao.StaffInfoDao;
import top.infopub.mgr.hr.service.StaffInfoService;
import top.infopub.mgr.hr.vo.StaffInfoVo;
import top.infopub.model.hr.StaffInfo;


@Service
public class StaffInfoServiceImpl extends GenericServiceImpl<StaffInfo, String> implements StaffInfoService {

    @Autowired
    private StaffInfoDao staffInfoDao;

    @Override
    public GenericDao<StaffInfo, String> getDao() {
        return staffInfoDao;
    }

    @Override
    public StaffInfoVo selectById(String id) {
        return staffInfoDao.selectById(id);
    }

    @Override
	public StaffInfo selectByPrimaryKey(String id){
	    StaffInfo staff = staffInfoDao.selectByPrimaryKey(id);
	    if(staff == null){
	        return new StaffInfo("-未绑定-");
	    }
	    return staff;
	}

    @Override
    public Page<StaffInfo> selectPageByGroupId(Page<StaffInfo> page, String groupId, String roleType) {
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        return (Page<StaffInfo>)staffInfoDao.selectByGroupId(groupId,roleType);
    }


    @Override
    public StaffInfo selectByCode(String code) {
        return staffInfoDao.selectByCode(code);
    }
}
